package com.nandasoft.njuerp.security;

import java.util.Properties;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.BeanInitializationException;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer;

import com.nandasoft.njuerp.commons.utils.DESPlus;



/**
 * Created by 乔挺 on 15-3-14.
 */
public class EncryptablePropertyPlaceholderConfigurer extends PropertyPlaceholderConfigurer {

    public static Logger log = Logger.getLogger(EncryptablePropertyPlaceholderConfigurer.class);
    protected void processProperties(ConfigurableListableBeanFactory beanFactory, Properties props) {
        try {
//            DESPlus des = new DESPlus();
//            String password = props.getProperty("password");
//            if (password != null) {
//                props.setProperty("password", des.decrypt(password));
//            }
            super.processProperties(beanFactory, props);
        } catch (Exception e) {
            e.printStackTrace();
            throw new BeanInitializationException(e.getMessage());
        }

    }



}
